<!DOCTYPE html>
<!--
  ~ Copyright (C) 2018 guomw.Inc. All rights reserved.
  ~ 项目名称： mysite
  ~ 文件名称： list.html
  ~ Date：18-10-15 下午3:33
  ~ Author: guomw
  -->

<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head th:include="/common/head::head('生成报告')">
<body class="gray-bg">
<div class="wrapper wrapper-content  animated fadeInRight">
    <form role="form" class="search-panel">
        <div class="row">
            <div class="col-lg-12">
                <div class="ibox float-e-margins">
                    <div class="ibox-content p-m no-borders">
                        <p style="height: 8px;"></p>
                        <div class="form-inline">
                            <label class="control-label">条&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;码：</label>
                            <span th:text="${test.barCode}"></span>
                        </div>
                        <p style="height: 8px;"></p>
                        <div class="form-inline">
                            <label class="control-label">检测项目：</label>
                            <span th:text="${test.projectName}"></span>
                        </div>
                        <p style="height: 8px;"></p>
                        <div class="form-inline">
                            <label class="control-label">用户：</label>
                            <span th:text="${test.userName}"></span>
                        </div>
                        <p style="height: 8px;"></p>
                        <div style="margin-top: 30px;"></div>
                        <div class="form-inline">
                            <label class="control-label">报告列表：</label>
                            <div th:each="item:${list}" style="margin-left: 24px;">
                                <div>
                                    <label th:text="${item.title}"></label>
                                    <button type="button" class="btn btn-success"
                                            th:onclick="'view(\''+${item.version}+'\',\''+${item.code}+'\')'">查看
                                    </button>

                                    <button type="button" class="btn btn-success"
                                            th:onclick="'download(\''+${item.version}+'\',\''+${item.code}+'\')'">下载
                                    </button>
                                </div>
                            </div>
                        </div>


                    </div>
                </div>
            </div>
        </div>
    </form>
    <input type="hidden" id="code" name="code" th:value="${code}"/>
    <iframe id="frmDownload" style="display: none"></iframe>
</div>

<footer th:include="/common/footer::js"/>
<script>
    function view(version, code) {
        var barCode = $("#code").val();
        window.location = '/user/viewReport?reportCode=' + code + '&reportVersion=' + version + '&barCode=' + barCode;

    }

    function download(version, code) {
        var barCode = $("#code").val();
        $("#frmDownload").attr("src", '/user/downloadReport?reportCode=' + code + '&reportVersion=' + version + '&barCode=' + barCode);
    }
</script>
</body>
</html>
